//
//  SSParticleExplosion.m
//  abbc
//
//  Created by shanshan on 10-5-11.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "SSParticleRingExplosion.h"


@implementation SSParticleRingExplosion
-(id) init
{
	return [self initWithTotalParticles:809];
}

-(id) initWithTotalParticles:(int)p
{
	if( (self=[super initWithTotalParticles:p]) ) {
		
		// duration
		duration = 0.1f;
		
		// gravity
		self.gravity = ccp(1.15f, 1.58f);
		
		// angle
		angle = 360;
		angleVar = 360;
		
		// speed of particles
		self.speed = 243;
		self.speedVar = 1;
		
		// radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
		
		// emitter position
		CGSize winSize = [[CCDirector sharedDirector] winSize];
		self.position = ccp(winSize.width/2, winSize.height/2);
		posVar = CGPointZero;
		
		// life of particles
		life = 3.0f;
		lifeVar = 1;
		
		// size, in pixels
		startSize = 34.0f;
		startSizeVar = 38.0f;
		endSize = 14;//kCCParticleStartSizeEqualToEndSize;
		
		// emits per second
		emissionRate = totalParticles/duration;
		
		// color of particles
		startColor.r = 0.89f;
		startColor.g = 0.56f;
		startColor.b = 0.36f;
		startColor.a = 1.0f;
		startColorVar.r = 0.2f;
		startColorVar.g = 0.2f;
		startColorVar.b = 0.2f;
		startColorVar.a = 0.5f;
		endColor.r = 0.0f;
		endColor.g = 0.0f;
		endColor.b = 0.0f;
		endColor.a = 0.84f;
		endColorVar.r = 0.0f;
		endColorVar.g = 0.0f;
		endColorVar.b = 0.0f;
		endColorVar.a = 0.0f;
		
		self.texture = [[CCTextureCache sharedTextureCache] addImage: @"fire.png"];
		
		// additive
		self.blendAdditive = NO;
	}
	
	return self;
}
@end

